package com.cadre.web.controller.officer;

import com.cadre.common.utils.R;
import com.cadre.system.domain.officer.Chart;
import com.cadre.system.service.ChartMsgService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RequestMapping({"/homeChart"})
@RestController
public class HomeChartController {
    @Resource
    private ChartMsgService chartMsgService;

    @RequestMapping({"/chartAll"})
    public R chartAll(String tagid) {
        List<Chart> list = new ArrayList<>();
        Chart c1 = new Chart();
        Chart c2 = new Chart();
        if (tagid.equals("10")) {
            c1.setName("中共");
            c1.setValue(13435L);
            c2.setName("非中共");
            c2.setValue(3160L);
        } else if (tagid.equals("7")) {
            c1.setName("汉族");
            c1.setValue(11352L);
            c2.setName("少数民族");
            c2.setValue(1260L);
        } else if (tagid.equals("3")) {
            c1.setName("男");
            c1.setValue(15532L);
            c2.setName("女");
            c2.setValue(1545L);
        }
        list.add(c1);
        list.add(c2);
        return R.ok().put("data", (Object) list);
    }

    @RequestMapping({"/chartAge"})
    public R chartAge(String tagid) {
        Chart chart1 = new Chart("40岁以下", 176L);
        Chart chart2 = new Chart("41-45岁", 1095L);
        Chart chart3 = new Chart("45-50岁", 4382L);
        Chart chart4 = new Chart("51-55岁", 8665L);
        Chart chart5 = new Chart("55-60岁", 7342L);
        Chart chart6 = new Chart("60岁以上", 30L);
        List<Chart> list = new ArrayList<>();
        list.add(chart1);
        list.add(chart2);
        list.add(chart3);
        list.add(chart4);
        list.add(chart5);
        list.add(chart6);
        return R.ok().put("data", (Object) list);
    }
}
